<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	List<TblApiBar> list = (List<TblApiBar>)request.getAttribute("list");
	BarForm form = (BarForm)request.getAttribute("command");
	String deviceid = StringUtils.isNotBlank(form.getDeviceid())?form.getDeviceid():"";
	String siteid = StringUtils.isNotBlank(form.getSiteid())?form.getSiteid():"";
%>

<div class="userListWrap">

     <form id="userListForm">
        <div class="form-item">
    		<label for="deviceid">巴枪编号:</label>
    		<input class="easyui-validatebox" type="text" name="deviceid" data-options="" value="<%=deviceid%>"/>
        </div>
        <div class="form-item form-item">
    		<a href="javascript:XF.Bar.listBarSearch()" class="input-btn-microsoft input-btn-microsoft-24">搜索</a>
        </div>
        
    </form>
    


    <table id="barListTable" class="easyui-datagrid"  title="" >
        <thead>
    		<tr>
    			<th data-options="field:'deviceid',width:360" orderByField='deviceid' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('deviceid')" >巴枪编号</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
										if("deviceid".equalsIgnoreCase(form.getOrderByField())){
											if("asc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px t" orderByMode='desc'>&nbsp;</span><%
						}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px d" orderByMode='asc'>&nbsp;</span><%
						}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
										}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
									}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			<th data-options="field:'siteid',width:100" orderByField='siteid' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('siteid')" >站点</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
										if("siteid".equalsIgnoreCase(form.getOrderByField())){
											if("asc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px t" orderByMode='desc'>&nbsp;</span><%
						}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px d" orderByMode='asc'>&nbsp;</span><%
						}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
										}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
									}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			<th data-options="field:'companyName',width:100" orderByField='companyName' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('companyName')" >巴枪厂商</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
										if("brand".equalsIgnoreCase(form.getOrderByField())){
											if("asc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px t" orderByMode='desc'>&nbsp;</span><%
						}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px d" orderByMode='asc'>&nbsp;</span><%
						}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
										}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
									}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
    			
    			
 				<th data-options="field:'addTime',width:140" orderByField='addTime' >
					<a class="order-field" href="javascript:XF.Bar.listBarSearch('addTime')" >注册时间</a>
					<%
						if(StringUtils.isNotBlank(form.getOrderByField()) && StringUtils.isNotBlank(form.getOrderByMode())){
										if("addTime".equalsIgnoreCase(form.getOrderByField())){
											if("asc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px t" orderByMode='desc'>&nbsp;</span><%
						}else if("desc".equalsIgnoreCase(form.getOrderByMode())){
					%><span class="px d" orderByMode='asc'>&nbsp;</span><%
						}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
										}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
									}else{
					%><span class="px" orderByMode='asc'>&nbsp;</span><%
						}
					%>
				</th>
				<th data-options="field:'opr',width:100">操作</th>
    		</tr>
        </thead>
        <tbody>
        	<%
        		if(!CollectionUtils.isEmpty(list)){
        	        			for(TblApiBar bar:list){
        	%>
       					 <tr s="<%=EncrypTool.encode(bar.getId()+"") %>">

							<td><i s="<%=EncrypTool.encode(bar.getId()+"")%>"></i><%=(null!=bar.getDeviceid())?bar.getDeviceid()+"":"" %></td>
       					 	<td><%=(null!=bar.getSiteName())?bar.getSiteName()+"":"" %></td>
       					 	<td><%=StringUtils.isNotBlank(bar.getCompanyName())?bar.getCompanyName():"" %></td>
       					 	<td><%=null!=bar.getAddTime()?DateFormatUtils.format(bar.getAddTime().getTime(), "yyyy-MM-dd HH:mm:ss"):"" %></td>
			    			
			    			<sec:authorize ifAnyGranted="MANAGE_BAR_APP,MANAGE_BAR">
				    			<td>
									<sec:authorize ifAllGranted="MANAGE_BAR">
										<a href="javascript:XF.Bar.deleteBar('<%=EncrypTool.encode(bar.getId()+"")%>')"><span>删除</span></a>
									</sec:authorize>
				    			</td>
			    			</sec:authorize>
			    		</tr>
        				<%
        			}
        		}
        	%>
    	</tbody>
    </table>
    <div class="pagination paginationFixWidth">
		<monggoTag:pagination 
		href="bar_search"
		pageSize="<%=form.getPageSize()%>" 
		totalRecord="<%=form.getTotalRecord() %>" 
		currentPage="<%=form.getPageNum() %>">
		</monggoTag:pagination> 
	</div>
</div>
<script>
	$('#barListTable').datagrid();  
</script>





























